/**
 * @description: 应用配置信息表
 * @version: 0.0.1
 * @author: z..
 * @Date: 2023-06-12 18:16:39
 */

import { Table, Model, Column, CreatedAt, UpdatedAt, DataType } from 'sequelize-typescript';

@Table({ tableName: 'user_records' })
export class UserRecords extends Model {
  @Column({
    primaryKey: true,       //主键
    autoIncrement: true,    //自增
    comment: "自增id"       //注释:只在代码中有效
  })
  id: number;

  @Column({
    type: DataType.TEXT,
    comment: "用户名"
  })
  nick: string;

  @Column({
    type: DataType.TEXT,
    comment: "员工在当前开发者企业账号范围内的唯一标识，系统生成，不会改变。"
  })
  union_id: string;

  @Column({
    type: DataType.TEXT,
    comment: "用户的userid"
  })
  user_id: string;
  
  @Column({
    type: DataType.TEXT,
    comment: "头像"
  })
  avatar_url: string;

  @Column({
    type: DataType.TEXT,
    comment: "open_id"
  })
  open_id: string;

  @Column({
    type: DataType.TEXT,
    comment: "电话"
  })
  mobile: string;

  @Column({
    type: DataType.TEXT,
    comment: "电话号码所属国家编码"
  })
  state_code: string;

  @Column({
    type: DataType.TEXT,
    comment: "access_token"
  })
  access_token: string;

  @Column({
    type: DataType.TEXT,
    comment: "refresh_token"
  })
  refresh_token: string;

  @Column({
    type: DataType.TEXT,
    comment: "token过期时间"
  })
  expires_time: string;

  @Column({
    type: DataType.NUMBER,
    comment: "用户所属部门id"
  })
  dept_id: number;

  @Column({
    type: DataType.TEXT,
    comment: "联系类型  0：企业内部员工  1：企业外部联系人"
  })
  contact_type: string;

  @Column({
    type: DataType.TEXT,
    comment: "所属部门id列表。"
  })
  dept_id_list: string;

  @Column({
    type: DataType.NUMBER,
    comment: "是否为企业的管理员 1是，0 不是"
  })
  is_admin: number;

  @Column({
    type: DataType.TEXT,
    comment: "其他信息"
  })
  other_info: string;

  @Column({
    type: DataType.TEXT,
    comment: "所属部门名称列表"
  })
  dept_name_list: string;

  @Column({
    type: DataType.NUMBER,
    comment: "用户账户状态，1正常，0禁用"
  })
  user_status: number;

  @Column({
    type: DataType.TEXT,
    comment: "用户职位"
  })
  user_title: string;

  @Column({
    type: DataType.TEXT,
    comment: "邮箱"
  })
  email: string;

  @CreatedAt
  created_at: Date;

  @UpdatedAt
  updated_at: Date;

  @Column({
    type: DataType.NUMBER,
    comment: "工时金额"
  })
  hours_amount: number
}